<?php
/**
 * Created by PhpStorm.
 * User: jz
 * Date: 16/7/11
 * Time: 上午9:14
 */
require_once('bookmark_fns.php');
session_start();
if (!isset($_SESSION['valid_user'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    if ($username && $password) {
        try {
            login($username, $password);
            $_SESSION['valid_user'] = $username;
        } catch (Exception $e) {
            do_html_header('登陆出错');
            echo '您不能登陆,只能浏览此页面<br>';
            echo $e->getMessage();
            do_html_url('login.php', '登陆');
            do_html_footer();
            exit;
        }
    }
}
do_html_header('主页');
check_valid_user();
if ($urls = get_user_urls($_SESSION['valid_user'])){
    display_user_urls($urls);
}
display_user_menu();
do_html_footer();
